/*
 * @Autor: dc
 * @Date: 2022-03-29 10:55:52
 * @LastEditors: dc
 * @LastEditTime: 2022-03-29 15:21:52
 * @Description: 消息详情
 */
import React, { Component } from 'react';
import qs from 'querystring'

const messageConten =  [
    { id: '01', content: '消息1内容' },
    { id: '02', content: '消息2内容' },
    { id: '03', content: '消息3内容' }
]
class index extends Component {
    render() {
        console.log(this.props)

        // 接收paramms参数
        // const {id,title} = this.props.match.params

        // 接收search参数
        // const {search} = this.props.location
        // const {id,title} = qs.parse(search.slice(1));

        // 接收state 
        const {id,title} = this.props.location.state;

        const messageObj = messageConten.find(item=>{
            return item.id === id;
        })
        return (
            <div>
                   <hr/>
                <ul>
                    <li>id:{id}</li>
                    <li>title:{title}</li>
                    <li>conten:{messageObj.content}</li>
                </ul>
            </div>
        );
    }
}

export default (index);